<?php
/**
 * Created by PhpStorm.
 * User: Zinces
 * Date: 2019/6/28
 * Time: 15:22
 */

namespace App\Http\Controllers\Traits;


trait SessionHelper
{
    function username(string $login)
    {
        $models = [
            'email' => filter_var($login,FILTER_VALIDATE_EMAIL),
            'phone' => preg_match('/^1[3456789]\d{9}$/',$login),
        ];
        foreach ($models as $k=>$v)
        {
            if ($v){
                return $k;
            }
        }
        return 'name';
    }
}
